<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Insert title here</title>
        <script>
			var some = function(x, y) {
			     console.log("sum : "+sum);
				var sum = x + y;
				console.log("sum : "+sum);
				return function() {
					return sum;
				};
			};
			
			var getData = some(3,6);
			
			var result = getData();// method가 끝났는데 아직 sum을 사용할 수 있게 된다. closer
			console.log("result : "+result); 
			
			var getData = some(5, 5);
			var result = getData();
			console.log("result : "+result);
			
			function fn(){
			 var test = function(){
			     console.log("inner function called");
			     return data;
			 };
			 return test;
			}
			
			fn.data = "Hello";
			console.log(fn()());
			var myRound = Math.round;
			console.log(myRound(4.5));
        </script>
    </head>
    <body>

    </body>
</html>